package com.quanjiaolian.chat.servlet;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.quanjiaolian.chat.service.ChatService;
import com.quanjiaolian.chat.serviceimpl.ChatServiceImpl;
import com.quanjiaolian.tools.ResponseToJson;

/**
 * 查看新鲜事详情
 * @author Herson_Li
 *
 */
@SuppressWarnings("serial")
public class ChatDetail extends HttpServlet {
	
	/**
	 * 声明Log4j变量
	 */
	public static ResourceBundle resourceBundle = null;
	static Logger logger = Logger.getLogger(ChatDetail.class.getName());
	
	ChatService cs = new ChatServiceImpl();
	Map<String,Object> resultMap = new HashMap<String,Object>();
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		String user_type = request.getParameter("user_type");
		String chat_id = request.getParameter("chat_id");
		try{
			resultMap.put("result", cs.queryChatDetailBychatId(Integer.parseInt(chat_id),Integer.parseInt(user_type)));
		}catch (Exception e) {
			resultMap.put("result","Error");
			e.printStackTrace();
		}
		ResponseToJson.responseOutWithJson(response,resultMap);
		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
	}

}
